var w;
var h;
var subwindow;
	   	
	if (document.all) {
	   w = screen.availWidth;
	   h = screen.availHeight;
	}
	else if (document.layers) {
	   w = window.innerWidth;
	   h = window.innerHeight;
	}	   	


// big regular window
function openWindow1(lnk) 
{
	//Ticket:111140 Changed width from 700 to 825 to accommodate the Browse button text if in localised language.
	var popW = 820, popH = 550;
	var topPos = (h-popH)/2, leftPos = (w-popW)/2;

	
	//var lnk;
	lnk = lnk.replace("%23","#");

	//To enable multi-session support - Venkat 04-01-03
	//SessionID passed as a Query string parameter from caller
	var sessionid = lnk.indexOf("sessionid=");
	if (sessionid != -1)
	{
		var sessionidstart; 
		sessionidstart = sessionid;
		//Extracting the SessionID value 
		sessionid = lnk.substr(sessionid + 10);
		lnk = lnk.substring(0,sessionidstart - 1);
	}
	//SessionID not passed - for compatibility with existing code
	else 	
	{
		sessionid = "sub";	
	}

	if (!subwindow || subwindow.closed)
	{
		subwindow =  window.open(lnk,sessionid,'height=' + popH + ',width=' + popW + 'screenY=' + topPos + ',screenX=' + leftPos +',top=' + topPos + ',left=' + leftPos + ',menubar=no,toolbar=no,resizable=yes,scrollbars=yes,alwaysRaised');
		if (!subwindow.opener)
		{
			subwindow.opener = window;
		}
		subwindow.focus();
	}
        else
	{
		subwindow.focus();
		window.open(lnk,sessionid);
        }
        try {
            if (typeof (top.popUpListenerKenexa) != 'undefined') {
                top.popUpListenerKenexa(subwindow);
            }
        }
        catch (e)
	{ }
}

function CloseSubWindow() {
    if (typeof(subwindow) != 'undefined' && typeof (subwindow.closed) != 'undefined')
        subwindow.close();
}
// modal dialog window
function openWindow2(lnk) 
{
	var popW = 498, popH = 525;
	var topPos = (h-popH)/2, leftPos = (w-popW)/2;

	var subwindow;
	var lnk;

	//To enable multi-session support - Venkat 04-01-03
	//SessionID passed as a Query string parameter from caller
	var sessionid = lnk.indexOf("sessionid=");
	if (sessionid != -1)
	{
		var sessionidstart;
		sessionidstart = sessionid;
		//Extracting the SessionID value 
		sessionid = lnk.substr(sessionid + 10);
		lnk = lnk.substring(0,sessionidstart - 1 );

	}
	//SessionID not passed - for compatibility with existing code
	else 	
	{
		sessionid = "sub";	
	}

	if (document.all) 
	{
		subwindow =  window.showModalDialog(lnk,sessionid,'dialogHeight:' + popH + ',dialogWidth:s' + popW + 'screenY=' + topPos + ',screenX=' + leftPos +',top=' + topPos + ',left=' + leftPos + ',menubar=no,toolbar=no,resizable=yes,scrollbars=yes,alwaysRaised');
	}
	else 
	{
		subwindow =  window.open(lnk,sessionid,'height=' + popH + ',width=' + popW + 'screenY=' + topPos + ',screenX=' + leftPos +',top=' + topPos + ',left=' + leftPos + ',menubar=no,toolbar=no,resizable=yes,scrollbars=yes,alwaysRaised');
	}
	subwindow.focus();
	if (typeof(top.popUpListenerKenexa) != 'undefined')
	{
		top.popUpListenerKenexa(subwindow);
	}
}
	




// popup -- same size as modal dialog
function openWindow3(lnk) 
{
	var popW = 498, popH = 525;
	var topPos = (h-popH)/2, leftPos = (w-popW)/2;

	var subwindow;
	//var lnk;
	lnk = lnk.replace("%23","#");

	//To enable multi-session support - Venkat 04-01-03
	//SessionID passed as a Query string parameter from caller
	var sessionid = lnk.indexOf("sessionid=");
	if (sessionid != -1)
	{
		var sessionidstart;
		sessionidstart = sessionid;
		//Extracting the SessionID value 
		sessionid = lnk.substr(sessionid + 10);
		lnk = lnk.substring(0,sessionidstart - 1 );
	}
	//SessionID not passed - for compatibility with existing code
	else 	
	{
  	  sessionid = "sub" + Math.floor(Math.random()*11);
    }

	if (!subwindow || subwindow.closed) {	    
	    subwindow =  window.open(lnk,sessionid,'height=' + popH + ',width=' + popW + ',screenY=' + topPos + ',screenX=' + leftPos +',top=' + topPos + ',left=' + leftPos + ',menubar=no,toolbar=no,resizable=yes,scrollbars=yes,alwaysRaised');

		if (!subwindow.opener) 
		{
			subwindow.opener = window;
		}
		subwindow.focus();
	}
	else 
	{
		subwindow.focus();
		window.open(lnk,sessionid);
    }
    try
	{
        if (typeof (top.popUpListenerKenexa) != 'undefined') {
            top.popUpListenerKenexa(subwindow);
        }
    }
    catch (e)
	{ }
}

// small dialog popup
function openWindow4(lnk) 
{

	var subwindow;
	var lnk;

	var popW = 400, popH = 300;
	var topPos = (h-popH)/2, leftPos = (w-popW)/2;

	//To enable multi-session support - Venkat 04-01-03
	//SessionID passed as a Query string parameter from caller
	var sessionid = lnk.indexOf("sessionid=");
	if (sessionid != -1)
	{
		var sessionidstart; 
		sessionidstart = sessionid;
		//Extracting the SessionID value 
		sessionid = lnk.substr(sessionid + 10);
		lnk = lnk.substring(0,sessionidstart - 1 );
	}
	//SessionID not passed - for compatibility with existing code
	else 	
	{
		sessionid = "sub";	
	}


	if (!subwindow || subwindow.closed)
	{
		subwindow =  window.open(lnk,sessionid,'height=' + popH + ',width=' + popW + 'screenY=' + topPos + ',screenX=' + leftPos +',top=' + topPos + ',left=' + leftPos + ',menubar=no,toolbar=no,resizable=yes,scrollbars=yes,alwaysRaised');
		if (!subwindow.opener)
		{
			subwindow.opener = window;
		}
		subwindow.focus();
	}
	else
	{
		subwindow.focus();      
		window.open(lnk,sessionid);                  
	}
	if (typeof(top.popUpListenerKenexa) != 'undefined')
	{
		top.popUpListenerKenexa(subwindow);
	}
}
        
function openWindow5(lnk) {

	var subwindow;
	//var lnk;
	lnk = lnk.replace("%23","#");
	var popW = 498, popH = 525;
	var topPos = (h-popH)/3, leftPos = (w-popW)/3;

	//To enable multi-session support - Venkat 04-01-03
	//SessionID passed as a Query string parameter from caller
	var sessionid = lnk.indexOf("sessionid=");
	if (sessionid != -1)
	{
		//Extracting the SessionID value 
		sessionid = lnk.substr(sessionid + 10);
	}
		//SessionID not passed - for compatibility with existing code
	else 	
	{
		sessionid = "sub";	
	}

	if (!subwindow || subwindow.closed)
	{
		subwindow =  window.open(lnk,sessionid,'height=' + popH + ',width=' + popW + 'screenY=' + topPos + ',screenX=' + leftPos +',top=' + topPos + ',left=' + leftPos + ',menubar=no,toolbar=no,resizable=yes,scrollbars=yes,alwaysRaised');
		if (!subwindow.opener)
		{
			subwindow.opener = window;
		}
		subwindow.focus();
	}
	else
	{
		subwindow.focus();
		window.open(lnk,sessionid);
	}
	if (typeof(top.popUpListenerKenexa) != 'undefined')
	{
		top.popUpListenerKenexa(subwindow);
	}
}


//this function is used for pop ups upon pop ups
//if multisession support is needed this is not recommended
//rather, this is for pop ups such as help or resume tips
function openWindow6(lnk) 
{
	var subwindow;
	lnk = lnk.replace("%23","#");
	var popW = 498, popH = 525;
	var topPos = (h-popH)/3, leftPos = (w-popW)/3;
	var nowms = (new Date()).getTime();

	if (!subwindow || subwindow.closed)
	{
		subwindow =  window.open(lnk,nowms,'height=' + popH + ',width=' + popW + 'screenY=' + topPos + ',screenX=' + leftPos +',top=' + topPos + ',left=' + leftPos + ',menubar=no,toolbar=no,resizable=yes,scrollbars=yes,alwaysRaised');
		if (!subwindow.opener)
		{
			subwindow.opener = window;
		}
		subwindow.focus();
	}
	else
	{
		subwindow.focus();
		window.open(lnk,nowms);
	}
	if (typeof(top.popUpListenerKenexa) != 'undefined')
	{
		top.popUpListenerKenexa(subwindow);
	}
}

//this function is used for pop ups upon pop ups
//if multisession support is needed this is not recommended
//rather, this is for pop ups such as help or resume tips
function openWindow7(lnk) 
{
	var subwindow;
	lnk = lnk.replace("%23","#");
	var popW = 974, popH = 718;
	var topPos = (h-popH)/3, leftPos = (w-popW)/3;
	var nowms = (new Date()).getTime();

	if (!subwindow || subwindow.closed)
	{
		subwindow =  window.open(lnk,nowms,'height=' + popH + ',width=' + popW + 'screenY=' + topPos + ',screenX=' + leftPos +',top=' + topPos + ',left=' + leftPos + ',menubar=no,toolbar=no,resizable=yes,scrollbars=yes,alwaysRaised');
	
		if (!subwindow.opener)
		{
			subwindow.opener = window;
		}
		subwindow.focus();
	}
	else
	{
		subwindow.focus();
		window.open(lnk,nowms);
	}
	if (typeof(top.popUpListenerKenexa) != 'undefined')
	{
		top.popUpListenerKenexa(subwindow);
	}
}
 
function openWindow22(lnk) {
    var popW = 1050, popH = 720;
    var topPos = (h - popH) / 2, leftPos = (w - popW) / 2;
    var subwindow = window.open(lnk, 'GQLogin', 'height=' + popH + ',width=' + popW + 'screenY=' + topPos + ',screenX=' + leftPos + ',top=' + topPos + ',left=' + leftPos + ',menubar=no,toolbar=no,resizable=yes,scrollbars=yes,alwaysRaised');
    subwindow.focus();
    if (typeof (top.popUpListenerKenexa) != 'undefined') {
        top.popUpListenerKenexa(subwindow);
    }
}
//RDP:243 Open the Submit Gateway Questionaire Menu click
function openWindow11(lnk) 
{       
	var popW = 820, popH = 550;
	var topPos = (h - popH) / 2, leftPos = (w - popW) / 2;
	var subwindow = window.open(lnk, 'GQLogin', 'height=' + popH + ',width=' + popW + 'screenY=' + topPos + ',screenX=' + leftPos + ',top=' + topPos + ',left=' + leftPos + ',menubar=no,toolbar=no,resizable=yes,scrollbars=yes,alwaysRaised');
	subwindow.focus();
	if (typeof(top.popUpListenerKenexa) != 'undefined')
	{
		top.popUpListenerKenexa(subwindow);
	}
}
function openWindow14(lnk) {
    var subwindow;
    lnk = lnk.replace("%23", "#");
    var popW = 660, popH = 480;
    var topPos = (h - popH) / 3, leftPos = (w - popW) / 3;
    var nowms = (new Date()).getTime();

    if (!subwindow || subwindow.closed) {
        subwindow = window.open(lnk, nowms, 'height=' + popH + ',width=' + popW + 'screenY=' + topPos + ',screenX=' + leftPos + ',top=' + topPos + ',left=' + leftPos + ',menubar=no,toolbar=no,resizable=yes,scrollbars=yes,alwaysRaised');
        if (!subwindow.opener) {
            subwindow.opener = window;
        }
        subwindow.focus();
    }
    else {
        subwindow.focus();
        window.open(lnk, nowms);
    }
    if (typeof (top.popUpListenerKenexa) != 'undefined') {
        top.popUpListenerKenexa(subwindow);
    }
}

function openWindowBySize(lnk, popH, popW) {
    var subwindow;
    lnk = lnk.replace("%23", "#");

    var topPos = (h - popH) / 3, leftPos = (w - popW) / 3;
    var nowms = (new Date()).getTime();

    if (!subwindow || subwindow.closed) {
        subwindow = window.open(lnk, nowms, 'height=' + popH + ',width=' + popW + 'screenY=' + topPos + ',screenX=' + leftPos + ',top=' + topPos + ',left=' + leftPos + ',menubar=no,toolbar=no,resizable=yes,scrollbars=yes,alwaysRaised');
        if (!subwindow.opener) {
            subwindow.opener = window;
        }
        subwindow.focus();
    }
    else {
        subwindow.focus();
        window.open(lnk, nowms);
    }
    if (typeof (top.popUpListenerKenexa) != 'undefined') {
        top.popUpListenerKenexa(subwindow);
    }
}

function openWindow12(lnk) {
    var subwindow;
    lnk = lnk.replace("%23", "#");
    var popW = 750, popH = 300;
    var topPos = (h - popH) / 2, leftPos = (w - popW) / 2;
    var nowms = (new Date()).getTime();

    if (!subwindow || subwindow.closed) {
        subwindow = window.open(lnk, nowms, 'height=' + popH + ',width=' + popW + 'screenY=' + topPos + ',screenX=' + leftPos + ',top=' + topPos + ',left=' + leftPos + ',menubar=no,toolbar=no,resizable=yes,scrollbars=yes,alwaysRaised');

        if (!subwindow.opener) {
            subwindow.opener = window;
        }
        subwindow.focus();
    }
    else {
        subwindow.focus();
        window.open(lnk, nowms);
    }
    if (typeof (top.popUpListenerKenexa) != 'undefined') {
        top.popUpListenerKenexa(subwindow);
    }
}

function openWindowBySize2(lnk, popW, popH) 
{    
    var topPos = (h - popH) / 2, leftPos = (w - popW) / 2;

    var subwindow;    
    lnk = lnk.replace("%23", "#");
    
    var sessionid = lnk.indexOf("sessionid=");
    if (sessionid != -1) {
        var sessionidstart;
        sessionidstart = sessionid;
        //Extracting the SessionID value 
        sessionid = lnk.substr(sessionid + 10);
        lnk = lnk.substring(0, sessionidstart - 1);
    }
    //SessionID not passed - for compatibility with existing code
    else {
        sessionid = "sub" + Math.floor(Math.random() * 11);
    }

    if (!subwindow || subwindow.closed) {
        subwindow = window.open(lnk, sessionid, 'height=' + popH + ',width=' + popW + ',screenY=' + topPos + ',screenX=' + leftPos + ',top=' + topPos + ',left=' + leftPos + ',menubar=no,toolbar=no,resizable=yes,scrollbars=yes,alwaysRaised');

        if (!subwindow.opener) {
            subwindow.opener = window;
        }
        subwindow.focus();
    }
    else {
        subwindow.focus();
        window.open(lnk, sessionid);
    }
    try {
        if (typeof (top.popUpListenerKenexa) != 'undefined') {
            top.popUpListenerKenexa(subwindow);
        }
    }
    catch (e)
	{ }
}

function resetTimeoutOpener() 
{    
    if (typeof (window.opener) != 'undefined')
    {
        window.opener.elapsedTime = 0;
    }
}
